
package edu.tongji.jiaowu.dao.jdbc;
 
import java.util.List;

import edu.tongji.jiaowu.dao.CollegeDao;
import com.tongji.quickCRUDQ.define.Row;
import com.tongji.quickCRUDQ.model.CommonBean;
import com.tongji.quickCRUDQ.dao.jdbc.BaseDaoJdbc;

public class CollegeDaoJdbc extends BaseDaoJdbc implements CollegeDao {
	String tableName="T_COLLEGE";
	String beanName="college";
	
	public CommonBean createCollege(){
		CommonBean colleges=this.createBean(tableName,beanName);
                return colleges;		
	}
	
/*
	public CommonBean findColleges(String refid) {
		CommonBean colleges=this.createCollege();
		String sql="select * from T_COLLEGE where refid=?";
		List data=this.getCommonDao().select(sql,new String[]{refid});
		colleges.addData(data);
                return colleges;
       }
*/
	public CommonBean findCollegeById(String id) {
		CommonBean colleges=this.createCollege();
		String sql="select * from T_COLLEGE where id=?";
		List data=this.getCommonDao().select(sql,new String[]{id});
		colleges.addData(data);
    return colleges;
  }
  
	public CommonBean findAllColleges() {
		CommonBean colleges=this.createCollege();
		String sql="select * from T_COLLEGE ";
		List data=this.getCommonDao().select(sql,new String[]{});
		colleges.addData(data);
    return colleges;
  }
	public void insertCollege(CommonBean collegeBean){
		List data=collegeBean.getData();
		Row row=this.getRow(tableName);
		this.getCommonDao().templateBatchInsert(row,data,this.getIdGenerator());
	}
}

